Emit a better error message when a patch is truncated#693
Open
ExplodingCabbage wants to merge 1 commit into
Open
Emit a better error message when a patch is truncated#693ExplodingCabbage wants to merge 1 commit into
ExplodingCabbage wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I propose this as a more conservative way to resolve #690. At least this will make clear to the end user what the problem is. Given that the only way we know of so far that one can stumble into generating a truncated patch like this is manually editing it in an editor with trim-on-save behaviour, it should usually be no big deal for an end user to fix the problem after seeing the error message.
Alternatives considered but that I don't really like:
The only further angle for improving the state of the world I have considered was to see if anything can be reasonably changed in editors. In an editor that has trim-on-save enabled by default and also supports syntax-specific settings (and has some such settings configured by default), trim-on-save behaviour should probably be disabled by default for patch files.
Except in my current editor, Zed, that's already the case; default settings contain:
and I think VSCode has trim-on-save off by default globally.
So I reckon the best I can do is just this. Commentary welcome.